package cn.guetzjb.sys.feign;

import cn.guetzjb.core.constant.SecurityConstants;
import cn.guetzjb.core.entity.R;
import cn.guetzjb.sys.domain.SysLogininfor;
import cn.guetzjb.sys.domain.SysUser;
import cn.guetzjb.sys.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteUserFeign", value = "sys-user-server")
public interface SysUserFeign {

    @GetMapping("/user/info/{username}")
    R<LoginUser> info(@PathVariable String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/user/register/{username}/{password}")
    R register(@PathVariable String username, @PathVariable String password, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    @PostMapping("/logininfor/addLogSuccess")
    boolean addLogSuccess(@RequestBody SysLogininfor sysLogininfor);

    @PostMapping("/logininfor/addLogError")
    boolean addLogError(@RequestBody SysLogininfor sysLogininfor);

    @PostMapping("/logininfor/addUserLoginInfo")
    boolean addUserLoginInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/user/changePwd/{userName}/{password}")
    boolean changePwd(@PathVariable String userName, @PathVariable String password, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
